﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MODULE_NHAPXUAT
{
    public partial class frm_bancan : Form
    {
        nhapxuatDataContext context = cls_nhapxuat.getcontext();
        private string sresult;
        private bool ispass = false;
        public bool _ispass
        {
            get { return ispass; }
            set { ispass = value; }

        }

        public string _result
        {
            get { return this.lbdata.Text; }
            set { this.lbdata.Text = value; }
        }
        public frm_bancan()
        {
            InitializeComponent();
        }

        private void serialPort1_DataReceived(object sender, System.IO.Ports.SerialDataReceivedEventArgs e)
        {
            this.lbdata.Text= this.serialPort1.ReadExisting();

           
        }

        private void frm_can_Load(object sender, EventArgs e)
        {
            try
            {
                this.serialPort1.Open();
                this.lbdata.Text = "0";
                this.lbmessage.Text = "Cổng com sẵn sàng.";
            }
            catch (Exception ex)
            {
                this.lbmessage.Text = "Không đọc được cổng com.";
            }

        }

        private void btOK_Click(object sender, EventArgs e)
        {

            this.Close();
            ispass = true;
        }

        private void btCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {   
            //this.lbdata.Text = this.textBox1.Text;
            cls_nhapxuat.strongluong = this.textBox1.Text;
            
        }
    }
}
